package com.hll.user_service.controller;

import com.hll.user_service.pojo.User;
import com.hll.user_service.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: Mr.Hu
 * @create: 2021-03-15 09:35
 */
@RestController
@RequestMapping("/user")
public class UserController {

  @Value("${server.port}")
  private String port;

  @Autowired private UserService userService;

  @GetMapping("/index")
  public String index() {
    return "order的端口：" + this.port;
  }

  @GetMapping("/all")
  public List<User> getUsers() {
    return userService.findAll();
  }
}
